//
//  BLSafeSetController.m
//  Byelone
//
//  Created by 乔小乔 on 2021/1/18.
//

#import "BLSafeSetController.h"
#import "BLMy_Cell_Set.h"
#import "BLSetPassWordController.h"
static NSString *reuse_BLMy_Cell_Set = @"Reuse_BLMy_Cell_Set";

@interface BLSafeSetController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableViewList;
@property (nonatomic, strong) NSArray *arrayData;
@end

@implementation BLSafeSetController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"安全设置";
    self.arrayData = @[@"登录密码",@"支付密码"];
    [self.tableViewList reloadData];
}
#pragma mark - delegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.arrayData.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSString *title = self.arrayData[indexPath.row];
    BLMy_Cell_Set *cell = [tableView dequeueReusableCellWithIdentifier:reuse_BLMy_Cell_Set forIndexPath:indexPath];
    cell.labelTitle.text = title;
    cell.labelContent.text = @"设置/重置";
    cell.labelContent.hidden = NO;
    cell.imgEnter.hidden = NO;
//    [cell reloadWithData:nil];
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 50;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *title = self.arrayData[indexPath.row];
    BLSetPassWordController *vc = [[BLSetPassWordController alloc]init];
    if ([title isEqualToString:@"登录密码"]) {
        vc.passWordType = BLPassWordTypeLogin;
    }else{
        vc.passWordType = BLPassWordTypePay;
    }
    [self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - set&get
- (UITableView *)tableViewList{
    if (!_tableViewList) {
        _tableViewList = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, BL_WINDOW_WIDTH, BL_CONTENT_HEIGHT)];
        [self.view addSubview:_tableViewList];
        _tableViewList.backgroundColor = [UIColor clearColor];
//        _tableViewList.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableViewList.delegate = self;
        _tableViewList.dataSource = self;
        if (@available(iOS 11.0, *)) {
            _tableViewList.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        }else{
            self.automaticallyAdjustsScrollViewInsets = NO;
        }
        [_tableViewList registerNib:[UINib nibWithNibName:@"BLMy_Cell_Set" bundle:nil] forCellReuseIdentifier:reuse_BLMy_Cell_Set];
        _tableViewList.tableFooterView = [UIView new];
    }
    return _tableViewList;
}
@end

